﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Framework_Tool
{
    /// <summary>
    /// Interaction logic for staffDelete.xaml
    /// </summary>
    public partial class StaffDelete : Page
    {
        private MainWindow main;

        public StaffDelete()
        {
            InitializeComponent();
            stfIDDeleteCmbx.Items.Clear();
            Database.FindStaffIDDelete(this);
        }

        private void viewStaff_Click(object sender, RoutedEventArgs e)
        {
            StaffView stfViewWindow = new StaffView();
            stfViewWindow.Content = null;
            mainContent.Children.Add(stfViewWindow.mainContent);
        }

        private void addStaff_Click(object sender, RoutedEventArgs e)
        {
            StaffAdd stfAddWindow = new StaffAdd(main);
            stfAddWindow.Content = null;
            mainContent.Children.Add(stfAddWindow.mainContent);
        }

        private void updateStaff_Click(object sender, RoutedEventArgs e)
        {
            StaffUpdate stfUpdateWindow = new StaffUpdate();
            stfUpdateWindow.Content = null;
            mainContent.Children.Add(stfUpdateWindow.mainContent);
        }

        private void searchStaff_Click(object sender, RoutedEventArgs e)
        {
            StaffSearch stfSearchWindow = new StaffSearch();
            stfSearchWindow.Content = null;
            mainContent.Children.Add(stfSearchWindow.mainContent);
        }

        private void cancelStaffDelete_Click(object sender, RoutedEventArgs e)
        {
            stfIDDeleteCmbx.SelectedItem = null;
            stfFNameTxt.Text = null;
            stfSurnameTxt.Text = null;
            stfJobTitleTxt.Text = null;
            stfTelNoTxt.Text = null;
            stfEmailTxt.Text = null;
            stfDeletedLblGrid.Visibility = Visibility.Hidden;
        }

        private void staffIDDeleteTxt_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            Database.populateStfDeleteFields(this);
        }

        private void stfDelete_Click(object sender, RoutedEventArgs e)
        {
            Database.DeleteStaff(this);
            stfIDDeleteCmbx.Items.Clear();
            Database.FindStaffIDDelete(this);
        }

        private void mainContent_Loaded(object sender, RoutedEventArgs e)
        {
            viewStaff.FontWeight = FontWeights.Normal;
            addStaff.FontWeight = FontWeights.Normal;
            updateStaff.FontWeight = FontWeights.Normal;
            deleteStaff.FontWeight = FontWeights.ExtraBold;
            searchStaff.FontWeight = FontWeights.Normal;

        }
    }
}
